package com.kwan.xframe.pay.ali;

import android.util.Log;

import java.util.Map;

import static com.kwan.xframe.pay.ali.OrderInfoUtil2_0.getOutTradeNo;

public class AliPayUtil {


	public static String APPID = "2018041302551650";
	public static String RSA_PRIVATE = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCAPVnliyek1tM01+elmdHObhB1TBemsuwF5MdUGy3XuqC9Z11DRC7kvbdjgIhvUpLoyMfX9wXCx1ZsIIrL7FMHTlrusJ5Bo5G7Fk+Kwj5ArZuL76bMs2iWiI1sbEHtCIsGrJMmWkyP2xIVPRycxyE6vSczhEQuEOQNH2w9EXNR8K9Bu4dGFaDyDW08R4Ju9qL/3bAEnrhvijHE0IyAEVc2LhicbhN4nbcnboc08dP1bvAWFpbb3Ay+W9zn3YesF5g2BKcQhKUQu8KrEbsi1k2meyCTPZvrGc/h6x355hxOACi7TH+kX85cFmgSEEiF9hFncecOYxNWTaJ43mAcID93AgMBAAECggEAH1PdhC/sbV51ljEwS8o58N3+c0k1dem7suzirO8+0bar0dlQdUBQ3FxkUpBxxBA+B1QVTfLwm1arDBsfDRYcamp/2FOZNZvJ3BRlNhahspc2qobPDq69XBjbw6LmsAsoO2cpQ3NHxNTVpA6b0MjsmzbePr2PElnZ/EKy5HBA5cE1asEIjWwWdW2Uw7aT+p3ATaUBgXVxFHf15xxRjSuaP44JXmbMi0j+Lzd834Hcbc2plp3e1s595aQ9+kIEkZy1EKekQrW/rwUi7ehKnml4hw3WHMlhrL5N+zd/owSrWCwhUGaB2Q84I7VToPycQg3KX6LTfg/msK5LHaavZGTWwQKBgQDlki0TaTNvpCYSZtX2K2k07y+n2FKslvCRZoQWWj0xpNbixncwI1ptaz1JPXx3XbeC+lqMVkNAVgzsrjU/GzmiqLpLdwFS53Sei10hpqMKbi5qyXDoSkHos6/Cmii5Cr7RR8hKgwJC32t5w4dlV+Db+zciyLP3dn7Lqi/uVcYtUQKBgQCPAMdKyw96axnQ8n3t2QgGz7Uc896BkOJgAeemYb2kYcgmIGlD8X4blaljuBgkFt4ZikQf8Al8Gn+umCBa7acSFpnxATEocm9fbhnXAOJGL4gDrn8svA8GZpbGLdBo+UMLdU9nkdqhqpFLI8YLl5WJoqPuT8yleZWIvroBJ+tORwKBgHbkhm24HQhjlcgP9B2CjAD7Is4lbWOu5DYZRq0g3PJZ8WQO7ulCVfG3CU1mB5D2OzUdHUny3u9x4U2uRytAmU/RXHH61vetoSr++COWXnfnaiip3MygsJOog40gM5jppLtUFrnoMYKanNm51uQ4Z97lsr9T/Ehb2Pz3Tc18JJ+RAoGBAITpRFHPyeMOCECcIU8fmMY75ymxv+zMrJpvKs8JqSlPeKd3GF995KfewkFcqZNhbaxvRkIo56fhOSsdWXUpzU6SkyHc6cOeGMWpn3ql56k0JEbHuIvrfkuErj4j9sCabCYKMnMgrQP1dHVSGpBLo0D5WUP2B08FYmZmXpsUby+hAoGAOXVFbtVtaL9BnaoaOeUVhE6TT6T3NyUwg4EHnYA18JEfpL9FAvmB+9eHBG4Oc/wC3Y5Je9IBqWHtJzjbrmJ/8k40RXJAxNAVw24UAdvmkyY45BoY+pGHJTL46qgwy843u7BgGDJuSaxycds3jroRtd9Im2jJez4wYr1YtiAvn4U=";
	public static String doPrePay() {

		//秘钥验证的类型 true:RSA2 false:RSA
		boolean rsa = true;
		//构造支付订单参数列表
		Map<String, String> params = OrderInfoUtil2_0.buildOrderParamMap(APPID, rsa, getOutTradeNo(), "0.01", "test title", "test detail");
		//构造支付订单参数信息
		String orderParam = OrderInfoUtil2_0.buildOrderParam(params);
		//对支付参数信息进行签名
		String sign = OrderInfoUtil2_0.getSign(params, RSA_PRIVATE, rsa);
		//订单信息
		final String orderInfo = orderParam + "&" + sign;
		//异步处理

		Log.e("kwan", "ali pay:" + orderInfo);
		return orderInfo;

	}
}
